package net.risesoft.risebi.collection.web.client;

import java.util.ArrayList;
import java.util.HashMap;
import java.util.List;
import java.util.Map;

import javax.servlet.http.HttpServletRequest;

import net.risesoft.risebi.collection.model.Application;
import net.risesoft.risebi.collection.model.Catalog;
import net.risesoft.risebi.collection.model.StatisticalObjectTreeNode;
import net.risesoft.risebi.collection.model.Template;
import net.risesoft.risebi.collection.model.User;
import net.risesoft.risebi.collection.model.UserSO;
import net.risesoft.risebi.collection.model.UserTemplate;
import net.risesoft.risebi.collection.service.ApplicationManager;
import net.risesoft.risebi.collection.service.CatalogManager;
import net.risesoft.risebi.collection.service.DynaBeanManager;
import net.risesoft.risebi.collection.service.StatisticalObjectTreeManager;
import net.risesoft.risebi.collection.service.StatisticalObjectTreeNodeManager;
import net.risesoft.risebi.collection.service.TemplateManager;
import net.risesoft.risebi.collection.service.UserManager;
import net.risesoft.risebi.collection.service.UserSOManager;
import net.risesoft.risebi.collection.service.UserTemplateManager;
import net.risesoft.risebi.collection.web.BaseAction;
import net.risesoft.risebi.commons.util.GUID;
import net.sf.json.JSONObject;

import org.apache.commons.beanutils.LazyDynaBean;
import org.apache.struts2.ServletActionContext;
import org.apache.struts2.convention.annotation.Action;
import org.apache.struts2.convention.annotation.Namespace;
import org.apache.struts2.convention.annotation.Result;

@Namespace("/client/SubUserAction")
public class SubUserAction extends BaseAction {
	
	private static final long serialVersionUID = -2372037848689190234L;
	
	private int resultSize = 0;
	private int pageSize = 10;
	private User user;
	private UserManager userManager;
	private UserSOManager userSOManager;

	private List<User> subUserList;
	private List<Template> templateList;

	private List<Catalog> catalogList;
	private List soInstanceList;

	private Catalog selectCatalog;
	private Application selectApplication;


	private String objectType;
	private TemplateManager templateManager;
	private UserTemplateManager userTemplateManager;
	private CatalogManager catalogManager;
	private StatisticalObjectTreeManager statisticalObjectTreeManager;
	private StatisticalObjectTreeNodeManager statisticalObjectTreeNodeManager;
	private StatisticalObjectTreeNode statisticalObjectTreeNode;
	private DynaBeanManager dynaBeanManager;
	private ApplicationManager applicationManager;

	private Template template;

	private User currentUser;
	private String userGuid;
	private String[] templateGuids;
	private String[] soGuids;

	@Action(value="saveSubUser",
			results={@Result(name="success", location="SubUserAction/listSubUser.action",type="redirect")}
	)
	public String saveSubUser() throws Exception {
		this.currentUser = getSessionUser();
		HttpServletRequest request = ServletActionContext.getRequest();
		try {

			Integer countU = userManager
					.getCount("select count(*) from User u where u.name='"
							+ user.getName() + "'");
			if (countU > 0) {
				this.addFieldError("user.name", "用户名重复！");
				return this.INPUT;
			}

			if (!request.getParameter("repassword").equals(user.getPassword())) {
				this.addFieldError("user.password", "两次输入的密码不一致！");
				return this.INPUT;
			}

			String subUserGuid = new GUID().toString();
			int tabIndex = 1;
			user.setUserkey(user.getName());
			user.setGuid(subUserGuid);
			user.setUserType(User.USERTYPE_ENTERPRISEUSER);
			user.setEnabled(true);
			user.setAuthentication_type(1);
			user.setOpenAccountType(3);
			user.setTabIndex(new Double(tabIndex++));
			user.setParentGuid(currentUser.getGuid());
			userManager.saveObject(user);
		} catch (Exception e) {
			e.printStackTrace();
			throw new Exception(e);
		}
		return SUCCESS;
	}

	@Action(value="listSubUser",
			results={@Result(name="success", location="/client/datapage/listSubUser.jsp")}
	)
	public String listSubUser() throws Exception {
		this.currentUser = getSessionUser();
		try {
			// List<User> lst = currentUser.getChildUsers();
			this.subUserList = userManager
					.find("from User u where u.parentUser.guid='"
							+ currentUser.getGuid() + "'");
			currentUser.setChildUsers(subUserList);

			if (subUserList != null && subUserList.size() > 0) {
				resultSize = subUserList.size();
			} else {
				resultSize = 0;
			}
		} catch (Exception e) {
			e.printStackTrace();
		}

		return SUCCESS;
	}

	@Action(value="prepareEdit",
			results={@Result(name="success", location="/client/datapage/editSubUser.jsp")}
	)
	public String prepareEdit() throws Exception {
		this.user = (User) userManager.getObject(User.class, user.getGuid());
		return SUCCESS;
	}

	@Action(value="edit",
			results={@Result(name="success", location="SubUserAction/listSubUser.action",type="redirect")}
	)
	public String edit() throws Exception {

		if (user.getRealName() == null
				|| user.getRealName().trim().length() < 1) {
			this.addFieldError("user.realName", "真实姓名不能为空！");
			this.user = (User) userManager
					.getObject(User.class, user.getGuid());
			return this.INPUT;
		}
		User tUser = (User) userManager.getObject(User.class, user.getGuid());
		tUser.setRealName(user.getRealName());
		tUser.setEmail(user.getEmail());
		tUser.setPhone(user.getPhone());
		tUser.setSex(user.getSex());

		userManager.saveObject(tUser);
		return SUCCESS;
	}

	@Action(value="prepareEditPS",
			results={@Result(name="success", location="/client/datapage/editSubUserPS.jsp")}
	)
	public String prepareEditPS() throws Exception {
		this.user = (User) userManager.getObject(User.class, user.getGuid());
		return SUCCESS;
	}

	public String editPS() throws Exception {
		HttpServletRequest request = ServletActionContext.getRequest();
		this.user = (User) userManager.getObject(User.class, user.getGuid());

		// if(!request.getParameter("user.password").equals(user.getPassword())){
		// this.addFieldError("user.password","原密码不正确！");
		// return this.INPUT;
		// }

		if (request.getParameter("repassword") == null
				|| request.getParameter("repassword").trim().length() < 1) {
			this.addFieldError("repassword", "密码不能为空！");
			return this.INPUT;
		} else if (!request.getParameter("repassword").equals(
				request.getParameter("cRepassword"))) {
			this.addFieldError("cRepassword", "两次输入的密码不一致！");
			return this.INPUT;
		} else {
			this.user.setPassword(request.getParameter("repassword"));
			userManager.saveObject(user);
			return this.EDIT;
		}
	}

	@Action(value="addSubUser",
			results={@Result(name="success", location="/client/datapage/addSubUser.jsp")}
	)
	public String addSubUser() throws Exception {
		this.user = null;
		return SUCCESS;

	}

	@Action(value="deleteSubUser",
			results={@Result(name="success", location="SubUserAction/listSubUser.action",type="redirect")}
	)
	public String deleteSubUser() throws Exception { 
		this.currentUser = getSessionUser();
		this.user = (User) userManager.getObject(User.class, user.getGuid());

		// 删除rpt_user
		userManager.removeObject(User.class, user.getGuid());
		// 删除rpt_user_so表
		userSOManager.execute("delete from UserSO u where u.user.guid='"
				+ user.getGuid() + "'");
		// 删除rpt_userTemplate
		userTemplateManager
				.execute("delete from UserTemplate u where u.user.guid='"
						+ user.getGuid() + "'");

		return SUCCESS;
	}

	@Action(value="checkUser")
	public String checkUser() throws Exception {
		LazyDynaBean ldb = new LazyDynaBean();
		Integer countU = userManager
				.getCount("select count(*) from User u where u.name='"
						+ user.getName() + "'");
		if (countU > 0) {
			ldb.set("success", false);
			ldb.set("reason", "【" + user.getName() + "】 该用户名重复!");
			this.json = JSONObject.fromObject(ldb).toString();

		} else {
			ldb.set("success", true);
			ldb.set("reason", "恭喜您，该用户名可以用!");
			this.json = JSONObject.fromObject(ldb).toString();
		}

		return AJAX;
	}

	@Action(value="listSubUserTemplate",
			results={@Result(name="success", location="/client/datapage/listSubUserTemplate.jsp")}
	)
	public String listSubUserTemplate() throws Exception {
		this.currentUser = getSessionUser();
		this.user = (User) userManager.getObject(User.class, user.getGuid());
//		this.applicationList=applicationManager.getAllByUser(currentUser);
		if(this.selectApplication==null){
			if (applicationList.size() > 0)
				selectApplication = (Application) applicationManager
						.getObject(Application.class,
								((Application) applicationList.get(0)).getGuid());
			else{
				selectApplication=new Application();
			    selectApplication.setGuid("");
			}  
		}else{
			this.selectApplication=(Application)applicationManager.getObject(Application.class, 
					this.selectApplication.getGuid());
		}
		// 列出已经授权了的
		// String
		// hql="from Template t where t.guid in( select ri.templateid  from  ReportInstance ri "
		String hql = "from Template  t where t.guid in (select u.template.guid from UserTemplate u where u.user.guid='"
				+ user.getGuid() + "') and t.application.guid='"+this.selectApplication.getGuid()+"'";
		this.templateList = templateManager.find(hql);
		if (templateList != null && templateList.size() > 0) {
			resultSize = templateList.size();
		} else {
			resultSize = 0;
		}
		return SUCCESS;
	}

	@Action(value="listSubUserSo",
			results={@Result(name="success", location="/client/datapage/listSubUserSo.jsp")}
	)
	public String listSubUserSo() throws Exception {
		this.currentUser = getSessionUser();
		this.user = (User) userManager.getObject(User.class, user.getGuid());
//		this.applicationList=applicationManager.getAllByUser(currentUser);
	
		if(this.selectApplication==null||this.selectApplication.getGuid().trim().length()<1){
//			if (applicationList.size() > 0)
//				selectApplication = (Application) applicationManager
//						.getObject(Application.class,
//								((Application) applicationList.get(0)).getGuid());
//			else{
//				selectApplication=new Application();
//			    selectApplication.setGuid(" ");
//			}
			selectApplication=new Application();
		    selectApplication.setGuid(" ");
		}else{
			this.selectApplication=(Application)applicationManager.getObject(Application.class, 
					this.selectApplication.getGuid());
		}
			

		// 列出已经授权了的
		String hql = "from Catalog c where c.guid in (select sotn.catalog.guid from   StatisticalObjectTreeNode sotn "
				+ " where sotn.parentStatisticalObjectTreeNode.guid in(select sotn2.guid from StatisticalObjectTreeNode  sotn2  "
				+ " where sotn2.catalog.guid in (select uso.so.guid    from  UserSO uso where uso.user.guid='"
				+ currentUser.getGuid() + "'))) and c.application.guid='"+this.selectApplication.getGuid()+"'";

		this.catalogList = catalogManager.find(hql);
		if (selectCatalog == null) {
			if (catalogList.size() > 0){
				selectCatalog = (Catalog) catalogManager
						.getObject(Catalog.class,
								((Catalog) catalogList.get(0)).getGuid());
			}else{
				this.selectCatalog=new Catalog();
				this.selectCatalog.setGuid("");
			}
		}
		

		this.selectCatalog=(Catalog) catalogManager.getObject(Catalog.class,
				this.selectCatalog.getGuid());


		 
		if (selectCatalog != null) {

			Catalog catalog = (Catalog) catalogManager.getObject(Catalog.class,
					this.selectCatalog.getGuid());

			String tablename = catalog.getTableName().toLowerCase();

			hql = "from "
					+ tablename
					+ "  t where  t.item_guid  in (select u.soInstanceGuid from UserSO u where u.user.guid='"
					+ this.user.getGuid() + "')"					
					+ " and t.catalog_guid in(select c.guid from Catalog c where c.application.guid='"+this.selectApplication.getGuid()+"')";

			// and t.app_guid='"+selectApplication.getGuid()+"'";

			this.soInstanceList = dynaBeanManager.find(hql);

			if (soInstanceList != null && soInstanceList.size() > 0) {
				resultSize = soInstanceList.size();
			} else {
				resultSize = 0;
			}

		} else {
			this.soInstanceList = new ArrayList();
			this.resultSize = 0;
		}

		return SUCCESS;
	}

	@Action(value="listSo",
			results={@Result(name="success", location="/client/datapage/listSo.jsp")}
	)
	public String listSo() throws Exception {
		this.currentUser = getSessionUser();
		this.user = (User) userManager.getObject(User.class, user.getGuid());
//		this.applicationList=applicationManager.getAllByUser(currentUser);
		this.selectApplication=(Application)applicationManager.getObject(Application.class, this.selectApplication.getGuid());
		
		if (selectCatalog != null) { 
			this.selectCatalog=(Catalog) catalogManager.getObject(Catalog.class,
					this.selectCatalog.getGuid());
		
			//根据user_guid查询当前主账号的能管理的所有catalog (Rpt_StatisticalObjectTreeNodes)
			String hql = "from  StatisticalObjectTreeNode sotn "
					+ " where sotn.parentStatisticalObjectTreeNode.guid in(select sotn2.guid from StatisticalObjectTreeNode  sotn2  "
					+ " where sotn2.catalog.guid in (select uso.so.guid    from  UserSO uso where uso.user.guid='"
					+ currentUser.getGuid() + "'))"
					+ " and sotn.catalog.guid='" + this.selectCatalog.getGuid()
					+ "'";

			this.statisticalObjectTreeNode = (StatisticalObjectTreeNode) this.statisticalObjectTreeNodeManager
					.find(hql).get(0);

			String parentColumnName = statisticalObjectTreeNode
					.getParentColumnName().toLowerCase();
			String selfColumnName = statisticalObjectTreeNode
					.getSelfColumnName().toLowerCase();

			Catalog catalog = (Catalog) catalogManager.getObject(Catalog.class,
					this.selectCatalog.getGuid());
			// 选择的产业活动单位的 tablename
			String tablename = catalog.getTableName().toLowerCase();

			// 获得主账号的 tablename
			hql = " from UserSO uso where uso.user.guid='"
					+ this.currentUser.getGuid() + "'";
			UserSO uso = (UserSO) userSOManager.find(hql).get(0);
			String currentUser_catalog = uso.getSo().getGuid();
			String currentuser_soInstanceGuid = uso.getSoInstanceGuid();

			Catalog currentUserCatalog = (Catalog) catalogManager.getObject(
					Catalog.class, currentUser_catalog);
			String currentUser_tableName = currentUserCatalog.getTableName().toLowerCase(); // 获得主账号的
			// tablename

			// 获得主账号的parentColumnName值。
			Map mapDynaBean = (HashMap<String, Object>) dynaBeanManager
					.getObject(currentUser_tableName,
							currentuser_soInstanceGuid);
			String parentColumnNameValue = (String) mapDynaBean
					.get(parentColumnName);
			// 排除已经授权了的
			hql = " from "
					+ tablename
					+ " t where t."
					+ selfColumnName
					+ "='"
					+ parentColumnNameValue
					+ "' and  t.item_guid not  in (select u.soInstanceGuid from UserSO u where u.user.guid='"
					+ this.user.getGuid() + "')"
					+ " and t.catalog_guid in(select c.guid from Catalog c where c.application.guid='"+this.selectApplication.getGuid()+"')";
			//and t.app_guid='"+this.selectApplication.getGuid()+"'";
			this.soInstanceList = dynaBeanManager.find(hql);

			if (soInstanceList != null && soInstanceList.size() > 0) {
				resultSize = soInstanceList.size();
			} else {
				resultSize = 0;
			}
		} else {
			this.soInstanceList = new ArrayList();
			this.resultSize = 0;
		}

		return SUCCESS;
	}

	@Action(value="addSo",
			results={@Result(name="success", type="redirectAction",params={"actionName","SubUserAction/listSubUserSo.action","user.guid","${user.guid}","selectCatalog.guid","${selectCatalog.guid}","selectApplication.guid","${selectApplication.guid}"})}
	)
	public String addSo() throws Exception {
		this.user = (User) userManager.getObject(User.class, this.user
				.getGuid());
		for (String s : soGuids) {
			Catalog catalog = (Catalog) catalogManager.getObject(Catalog.class,
					selectCatalog.getGuid());
			String userSoGuid = new GUID().toString();

			UserSO userSo = new UserSO();
			userSo.setGuid(userSoGuid);
			userSo.setSo(catalog);
			userSo.setSoInstanceGuid(s);
			userSo.setUser(this.user);
			this.userSOManager.saveObject(userSo);
		}
		return SUCCESS;
	}

	@Action(value="deleteSo",
			results={@Result(name="success", type="redirectAction",params={"actionName","SubUserAction/listSubUserSo.action","user.guid","${user.guid}","selectCatalog.guid","${selectCatalog.guid}","selectApplication.guid","${selectApplication.guid}"})}
	)
	public String deleteSo() throws Exception {
		this.currentUser = getSessionUser();
		this.user = (User) userManager.getObject(User.class, user.getGuid());
		this.selectCatalog=(Catalog) catalogManager.getObject(Catalog.class,
				this.selectCatalog.getGuid());

		this.selectApplication=(Application) applicationManager.getObject(Application.class,
				this.selectApplication.getGuid());
		
		for (String s : soGuids) {
			userSOManager.execute("delete from UserSO u where u.user.guid='"
					+ user.getGuid() + "' and u.soInstanceGuid='" + s + "'");
		}
		return SUCCESS;
	}

	@Action(value="deleteTemplate",
			results={@Result(name="success", type="redirectAction", params={"actionName","SubUserAction/listSubUserTemplate.action","user.guid","${user.guid}","selectApplication.guid","${selectApplication.guid}"})}
	)
	public String deleteTemplate() throws Exception {
		this.currentUser = getSessionUser();
		this.user = (User) userManager.getObject(User.class, user.getGuid());

		for (String t : templateGuids) {
			userTemplateManager
					.execute("delete from UserTemplate u where u.user.guid='"
							+ user.getGuid() + "' and u.template.guid='" + t
							+ "'");
		}
		return SUCCESS;
	}

	@Action(value="addTemplate",
			results={@Result(name="success", type="redirectAction",params={"actionName","SubUserAction/listSubUserTemplate.action","user.guid","${user.guid}","selectApplication.guid","${selectApplication.guid}"})}
	)
	public String addTemplate() throws Exception {
		HttpServletRequest request = ServletActionContext.getRequest();

		this.user = (User) userManager.getObject(User.class, this.user
				.getGuid());
		for (String t : templateGuids) {
			String userTemplateGuid = new GUID().toString();
			Template templateT = (Template) templateManager.getObject(
					Template.class, t);
			UserTemplate userTemplate = new UserTemplate();
			userTemplate.setGuid(userTemplateGuid);
			userTemplate.setPermission(4);
			userTemplate.setTemplate(templateT);
			userTemplate.setUser(this.user);
			this.userTemplateManager.saveObject(userTemplate);

		}

		return SUCCESS;
	}

	@Action(value="listTemplate",
			results={@Result(name="success", location="/client/datapage/listTemplate.jsp")}
	)
	public String listTemplate() throws Exception {
		this.currentUser = getSessionUser();
		this.user = (User) userManager.getObject(User.class, user.getGuid());
//		this.applicationList=applicationManager.getAllByUser(currentUser);
		if(this.selectApplication==null){
			if (applicationList.size() > 0)
				selectApplication = (Application) applicationManager
						.getObject(Application.class,((Application)applicationList.get(0)).getGuid());
			else{
				selectApplication=new Application();
			    selectApplication.setGuid("");
			}  
		}else{
//			this.selectApplication=(Application)applicationManager.getObject(Application.class, this.selectApplication.getGuid());			
		}
		//根据user_guid查询当前主账号的能管理的所有catalog (Rpt_StatisticalObjectTreeNodes)
		String hql = "from  StatisticalObjectTreeNode sotn "
				+ " where sotn.parentStatisticalObjectTreeNode.guid in(select sotn2.guid from StatisticalObjectTreeNode  sotn2  "
				+ " where sotn2.catalog.guid in (select uso.so.guid    from  UserSO uso where uso.user.guid='"
				+ currentUser.getGuid() + "'))";

		     List sotns =this.statisticalObjectTreeNodeManager.find(hql);
			 String catalogHql="";	
			for (StatisticalObjectTreeNode s : (ArrayList<StatisticalObjectTreeNode>)sotns) {
				catalogHql+="'"+s.getCatalog().getGuid()+"',";			
			}
		    
			 List usos=this.userSOManager.getUserSOByUid(currentUser.getGuid());
			for (UserSO s : (ArrayList<UserSO>)usos) {
					catalogHql+="'"+s.getSo().getGuid()+"',";			
				}
				
			
			if(catalogHql.endsWith(",")){
				catalogHql=catalogHql.substring(0, catalogHql.length()-1);
			}
				
		 
		//select * from rpt_reportinstance where so_guid in('BFA7823A00000000389DEB7600000001','BFA7823A0000000038A0719900000003')

		// 排除已经授权了的
		// String
		// hql="from Template t where t.guid in( select ri.templateid  from  ReportInstance ri "
//		 hql = " from Template t where t.guid in "
//				+ "(select ri.template.guid from ReportInstance ri where ri.soInstance.guid in "
//				+ "(select us.soInstanceGuid  from UserSO us where us.user.guid='"
//				+ currentUser.getGuid()
//				+ "'))";
//				+ " and t.guid not in (select ut.template.guid from UserTemplate ut where ut.user.guid='"
//				+ user.getGuid() + "')";
		 hql = " from Template t where t.guid in "
				+ "(select ri.template.guid from ReportInstance ri where ri.soGuid in("+catalogHql+"))"
			    + " and t.guid not in (select ut.template.guid from UserTemplate ut where ut.user.guid='"
			    + user.getGuid() + "') and t.application.guid='"+selectApplication.getGuid()+"'";
		 
		this.templateList = templateManager.find(hql);
		if (templateList != null && templateList.size() > 0) {
			resultSize = templateList.size();
		} else {
			resultSize = 0;
		}

		return SUCCESS;
	}

	public String prepareSetSo() throws Exception {
		User currentUser = getSessionUser();
		// 列出已经授权了的
		// String
		// hql="from Template t where t.guid in( select ri.templateid  from  ReportInstance ri "
		return "listSubUserSo";
	}

	public int getResultSize() {
		return resultSize;
	}

	public void setResultSize(int resultSize) {
		this.resultSize = resultSize;
	}

	public int getPageSize() {
		return pageSize;
	}

	public void setPageSize(int pageSize) {
		this.pageSize = pageSize;
	}

	public User getUser() {
		return user;
	}

	public void setUser(User user) {
		this.user = user;
	}

	public UserManager getUserManager() {
		return userManager;
	}

	public void setUserManager(UserManager userManager) {
		this.userManager = userManager;
	}

	public List<User> getSubUserList() {
		return subUserList;
	}

	public void setSubUserList(List<User> subUserList) {
		this.subUserList = subUserList;
	}

	public String getObjectType() {
		return objectType;
	}

	public void setObjectType(String objectType) {
		this.objectType = objectType;
	}

	public List<Template> getTemplateList() {
		return templateList;
	}

	public void setTemplateList(List<Template> templateList) {
		this.templateList = templateList;
	}

	public List<Catalog> getCatalogList() {
		return catalogList;
	}

	public void setCatalogList(List<Catalog> catalogList) {
		this.catalogList = catalogList;
	}

	public TemplateManager getTemplateManager() {
		return templateManager;
	}

	public void setTemplateManager(TemplateManager templateManager) {
		this.templateManager = templateManager;
	}

	public User getCurrentUser() {
		return currentUser;
	}

	public void setCurrentUser(User currentUser) {
		this.currentUser = currentUser;
	}

	public Template getTemplate() {
		return template;
	}

	public void setTemplate(Template template) {
		this.template = template;
	}

	public UserTemplateManager getUserTemplateManager() {
		return userTemplateManager;
	}

	public void setUserTemplateManager(UserTemplateManager userTemplateManager) {
		this.userTemplateManager = userTemplateManager;
	}

	public UserSOManager getUserSOManager() {
		return userSOManager;
	}

	public void setUserSOManager(UserSOManager userSOManager) {
		this.userSOManager = userSOManager;
	}

	public CatalogManager getCatalogManager() {
		return catalogManager;
	}

	public void setCatalogManager(CatalogManager catalogManager) {
		this.catalogManager = catalogManager;
	}

	public String[] getSoGuids() {
		return soGuids;
	}

	public void setSoGuids(String[] soGuids) {
		this.soGuids = soGuids;
	}

	public String[] getTemplateGuids() {
		return templateGuids;
	}

	public void setTemplateGuids(String[] templateGuids) {
		this.templateGuids = templateGuids;
	}

	public String getUserGuid() {
		return userGuid;
	}

	public void setUserGuid(String userGuid) {
		this.userGuid = userGuid;
	}

	public StatisticalObjectTreeManager getStatisticalObjectTreeManager() {
		return statisticalObjectTreeManager;
	}

	public void setStatisticalObjectTreeManager(
			StatisticalObjectTreeManager statisticalObjectTreeManager) {
		this.statisticalObjectTreeManager = statisticalObjectTreeManager;
	}

	public StatisticalObjectTreeNodeManager getStatisticalObjectTreeNodeManager() {
		return statisticalObjectTreeNodeManager;
	}

	public void setStatisticalObjectTreeNodeManager(
			StatisticalObjectTreeNodeManager statisticalObjectTreeNodeManager) {
		this.statisticalObjectTreeNodeManager = statisticalObjectTreeNodeManager;
	}

	public DynaBeanManager getDynaBeanManager() {
		return dynaBeanManager;
	}

	public void setDynaBeanManager(DynaBeanManager dynaBeanManager) {
		this.dynaBeanManager = dynaBeanManager;
	}

	public StatisticalObjectTreeNode getStatisticalObjectTreeNode() {
		return statisticalObjectTreeNode;
	}

	public void setStatisticalObjectTreeNode(
			StatisticalObjectTreeNode statisticalObjectTreeNode) {
		this.statisticalObjectTreeNode = statisticalObjectTreeNode;
	}

	public Catalog getSelectCatalog() {
		return selectCatalog;
	}

	public void setSelectCatalog(Catalog selectCatalog) {
		this.selectCatalog = selectCatalog;
	}

	public Application getSelectApplication() {
		return selectApplication;
	}

	public void setSelectApplication(Application selectApplication) {
		this.selectApplication = selectApplication;
	}


	public List<Application> getApplicationList() {
		return applicationList;
	}

	public void setApplicationList(List<Application> applicationList) {
		this.applicationList = applicationList;
	}

	private List<Application> applicationList;

	public List getSoInstanceList() {
		return soInstanceList;
	}

	public void setSoInstanceList(List soInstanceList) {
		this.soInstanceList = soInstanceList;
	}

	public ApplicationManager getApplicationManager() {
		return applicationManager;
	}

	public void setApplicationManager(ApplicationManager applicationManager) {
		this.applicationManager = applicationManager;
	}
}
